/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package linkeddata.arida.ufc.br.test;

import java.io.IOException;
import linkeddata.arida.ufc.br.manager.impl.ExecuteQueryJena;
import linkeddata.arida.ufc.br.util.OWLUtils;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
import org.semanticweb.owlapi.model.OWLOntologyStorageException;

/**
 *
 * @author jeovane
 */
public class ExamplesExecute extends OWLUtils {

    public static void main(String[] args) throws OWLOntologyCreationException, IOException, OWLOntologyStorageException, Exception {
        
        //linkeddata.arida.ufc.br.rascunhos.BuildsSparqlQueryRasc rasc = new linkeddata.arida.ufc.br.rascunhos.BuildsSparqlQueryRasc();
        AssemblesQuery aq = new AssemblesQuery();
        
        String endpoint = "http://localhost:3030/dailymed/sparql";
//        String queryString =
//                "PREFIX dailymed: <http://www4.wiwiss.fu-berlin.de/dailymed/resource/dailymed/> \n"
//                + "PREFIX owl: <http://www.w3.org/2002/07/owl#> \n"
//                + "PREFIX sider: <http://www4.wiwiss.fu-berlin.de/sider/resource/sider/> \n"
//                + "SELECT ?dailymedfullName ?sidersideEffectName \n"
//                + "WHERE { \n"
//                + "SERVICE <http://localhost:3030/dailymed/sparql> { \n"
//                + "?dm dailymed:fullName ?dailymedfullName. \n"
//                + "?dm owl:sameAs ?sa. \n"
//                + "} \n"
//                + "SERVICE <http://localhost:3030/sider/sparql> { \n"
//                + "?sa sider:sideEffect ?se. \n"
//                + "?se sider:sideEffectName ?sidersideEffectName. \n"
//                + "} \n"
//                + "} limit 20";
        
        String queryString = 
                "PREFIX drugbank: <http://www4.wiwiss.fu-berlin.de/drugbank/resource/drugbank/>\n" +
                "PREFIX dailymed: <http://www4.wiwiss.fu-berlin.de/dailymed/resource/dailymed/>\n" +
                "\n" +
                "SELECT ?gn1 ?indication1  ?gn2 ?indication2  \n" +
                "WHERE{\n" +
                " { SERVICE <http://localhost:3030/drugbank/sparql> {\n" +
                "    select * \n" +
                "    where {\n" +
                "      ?dn drugbank:genericName ?gn1 ;\n" +
                "           drugbank:indication ?indication1 ;\n" +
                "    } limit 100\n" +
                " }\n" +
                "}  \n" +
                "UNION\n" +
                "  { SERVICE <http://localhost:3030/dailymed/sparql> {\n" +
                "           select * \n" +
                "           where {\n" +
                "             ?dn1 dailymed:name ?gn2 ;\n" +
                "                  dailymed:indication ?indication2 ;\n" +
                "           } limit 100\n" +
                "     }\n" +
                "  }\n" +
                "}";
        
        ExecuteQueryJena jena = new ExecuteQueryJena(endpoint, queryString);

        //ex.shouldLoad();
        //ex.shouldSaveOntologies();
        //ex.shouldBuildDataRanges();
        //ex.shouldAddAxiom();
        //ex.shouldCreateOntology();
        //ex.shouldCreatePropertyAssertions();
        //ex.shouldAddObjectPropertyAssertions();
        //ex.shouldUseReasoner();
        //ex.shouldLookAtRestrictions();

        //ad.viewClassOnto();
        //ad.viewObjectPropertyOnto(); 
        //ad.viewHierarchyOnto();
        //ad.lookAtRestrictionsOnto();
        //ad.buildSelect();
        //ad.buildWhere();
        
        //ad.isRange();
        //ad.shouldUseReasoner();
        
        aq.executeQuery();
        
        //aq.clazz();
        
    }
}
